<?php

import('com.yamvc.model.Proxy');
import("com.yado.DriverManager");
import("com.yado.drivers.ITable");

class PagesDataProxy extends Proxy {
	const NAME="pagesDataProxy";
	/**
	 * Enter description here...
	 *
	 * @var IConnection
	 */
	private $_page;
	private $_tableName;
	private $_backendConfig=array(
		"addPage"=>array(
			"title"=>array("length"=>50,"name"=>"Title","type"=>"text"),
			"content"=>array("name"=>"Content","type"=>"textarea")
		)
	);
	public function getBackendConfig(){
		return $this->_backendConfig;
	}
	public function __construct(){
		parent::__construct();
		$this->_tableName = $this->getConfig()->get("config.db.pagesTableName");
		$this->_page = $this->_connection->createTableDescriptor($this->_tableName)->createTable();//new Table(new TableDescriptor($this->_tableName,$this->_connection));
	}
	
	public function getPage($pageId){
		$this->_page->init($pageId);
		return $this->_page;
	}
	
	public function addPage($title,$content){
		$page = $this->_connection->createTableDescriptor($this->_tableName)->createTable();
		//$page = 
		echo "ME WAS EXECUTED!!!";
	}
	
	
}

?>